package com.xiaoxi.bridgemode.realization;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.bridgemode.realization
 * @ClassName StringDisplayImpl
 * @Description TODO
 * @Date 2023/3/13 19:54
 * @Version 1.0
 */
public class CharDisplayImpl implements DisplayImpl {

    private char begin;
    private char ch;
    private char end;
    private int index;

    public CharDisplayImpl(char begin, char ch, char end) {
        this.begin = begin;
        this.ch = ch;
        this.index = 1;
        this.end = end;
    }

    @Override
    public void rawOpen() {
        System.out.println(begin + "" + end);
    }

    @Override
    public void rawPrint() {
        System.out.print(begin);
        for (int i = 1; i <= index; i++) {
            System.out.print(ch);
        }
        index++;
        System.out.print(end + "\n");
    }

    @Override
    public void rawClose() {

    }

}
